package me.aartikov.alligator.commands;

import me.aartikov.alligator.OhosNavigator;
import me.aartikov.alligator.util.Log;
import me.aartikov.alligator.Screen;
import me.aartikov.alligator.animations.AnimationData;
import me.aartikov.alligator.destinations.AbilityDestination;
import me.aartikov.alligator.destinations.DialogFragmentDestination;
import me.aartikov.alligator.destinations.FragmentDestination;
import me.aartikov.alligator.exceptions.NavigationException;
import me.aartikov.alligator.navigators.AbilityNavigator;
import me.aartikov.alligator.navigators.DialogFragmentNavigator;
import me.aartikov.alligator.navigators.FragmentNavigator;

/**
 * Command implementation for {@code reset} method of {@link OhosNavigator}.
 */
public class ResetCommand extends BaseCommand {
	private Screen mScreen;

	private AnimationData mAnimationData;

	public ResetCommand( Screen screen,  AnimationData animationData) {
		super(screen.getClass());
		mScreen = screen;
		mAnimationData = animationData;
	}

	@Override
	protected boolean executeForActivity(AbilityDestination destination, AbilityNavigator activityNavigator) throws NavigationException {
		return activityNavigator.reset(mScreen, destination, mAnimationData);
	}

	@Override
	protected boolean executeForFragment(FragmentDestination destination, FragmentNavigator fragmentNavigator) throws NavigationException {
		Log.i("ResetCommand.executeForFragment([destination, fragmentNavigator]):35");
		return fragmentNavigator.reset(mScreen, destination, mAnimationData);
	}

	@Override
	protected void executeForDialogFragment(DialogFragmentDestination destination, DialogFragmentNavigator dialogFragmentNavigator) throws NavigationException {
		dialogFragmentNavigator.reset(mScreen, destination, mAnimationData);
	}
}
